package com.wj.infrastructure.repository;

import com.wj.domain.entity.BookShelfEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

public interface BookShelfRepository extends JpaRepository<BookShelfEntity, Long> {

    Optional<BookShelfEntity> findByUserIdAndBookId(Long userId, Long bookId);

    @Transactional
    void deleteByBookIdAndUserId(Long bookId, Long userId);
}
